﻿// Copyright (c) Inossem. All rights reserved.
// Licensed under the LGPL-3.0 license. See LICENSE file in the project root for full license information.
using DWF.Studio.Host;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DWF.Studio.Script.Implementation
{
    internal class SnippetScript : WorkflowScript
    {
        public SnippetScript(string projectDirectory, string path)
        {
            this.IsStart = false;
            this.ProjectDirectory = projectDirectory;
            this.FilePath = path;
            this.FileName = Path.GetFileName(this.FilePath);
            var loaderHost = RemoteLoaderHost.GetCurrentInstance();
            CurrentDesignerHost = new RemoteDesignerHost(loaderHost.LoadDesignerProxy(), true);
            this.ScriptEditor = CurrentDesignerHost.GetDesignerView();
            this.PropertyBar1 = CurrentDesignerHost.GetPropertiesView();
            this.PropertyBar2 = CurrentDesignerHost.GetOutlineView();
        }

        public override bool TrySave(out string messge)
        {
            var result = true;
            messge = String.Empty;
            return result;
        }
        public override void SetReadOnly(bool isReadOnly)
        {
            IsReadOnly = isReadOnly;
            CurrentDesignerHost?.SetReadOnly(true);
        }
    }
}
